import React, { Component } from 'react';
import { Layout } from 'antd';
import Aside from './../../components/BackNavLeft';
import menuCodes from './../../config/menuCodes';
const { Content, Sider } = Layout;

class User extends Component {
	state = {
		menu_codes: menuCodes
	}
	
	UNSAFE_componentWillMount(){
		let backMenu = sessionStorage.getItem("backmenu");
		if(backMenu){
			let arr = [...JSON.parse(backMenu)];
			
			if(arr[0] && arr[0].icon){
				arr[0].icon = "#icon-huabanzhuti";
			}
			if(arr[1] && arr[1].icon){
				arr[1].icon = "#icon-jiankong";
			}
			if(arr[2] && arr[2].icon){
				arr[2].icon = "#icon-yonhu";
			}
			if(arr[3] && arr[3].icon){
				arr[3].icon = "#icon-jiaoseguanli1";
			}
			if(arr[4] && arr[4].icon){
				arr[4].icon = "#icon-IP";
			}
			if(arr[5] && arr[5].icon){
				arr[5].icon = "#icon-report-qt";
			}
			if(arr[6] && arr[6].icon){
				arr[6].icon = "#icon-kuozhan";
			}
			if(arr[7] && arr[7].icon){
				arr[7].icon = "#icon-caidan";
			}
			if(arr[8] && arr[8].icon){
				arr[8].icon = "#icon-API";
			}
			if(arr[9] && arr[9].icon){
				arr[9].icon = "#icon-rizhi";
			}
			this.setState({
				menu_codes: arr
			})
		}
	}
	render(){
		
		return (
			<Layout style={{height: '100%'}}>
				<Sider width={220}>
					<Aside menuType="back" menuList={this.state.menu_codes} />
				</Sider>
				<Content style={{ background: '#fff' }}>
					{this.props.children}
				</Content>
			</Layout>
		)
	}
}

export default User;